<!DOCTYPE HTML>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-ipList-add">
			<div class="form-group">	
				<label class="col-sm-3 control-label">ip地址：</label>
				<div class="col-sm-8">
					<input id="ip" name="ip" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">ip名单类型：</label>
				<div class="col-sm-8">
					<div class="input-group" style="width: 100%">
						<select name="ipListType" class="form-control m-b"
								th:with="type=${@dict.getType('sys_ip_type')}">
							<option th:each="dict : ${type}" th:text="${dict.dictLabel}"
									th:value="${dict.dictValue}"></option>
						</select>
					</div>
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">状态：</label>
				<div class="col-sm-8">
					<div class="onoffswitch">
						<input type="checkbox" th:checked="true" class="onoffswitch-checkbox" id="ip-state">
						<label class="onoffswitch-label" for="ip-state">
							<span class="onoffswitch-inner"></span>
							<span class="onoffswitch-switch"></span>
						</label>
					</div>
				</div>
			</div>
		</form>
	</div>
    <div th:include="include::footer"></div>
    <script type="text/javascript">
		var prefix = ctx + "system/ipList"
		$("#form-ipList-add").validate({
			rules:{
				xxxx:{
					required:true,
				},
			},
			focusCleanup: true
		});
		
		function submitHandler() {
	        if ($.validate.form()) {
                var data = $('#form-ipList-add').serializeArray();
                var state = $("input[id='ip-state']").is(':checked') == true ? 1 : 0;
                data.push({"name": "state", "value": state});
	            $.operate.save(prefix + "/add", data);
	        }
	    }
	</script>
</body>
</html>
